const TOKEN = localStorage.token;
import {developUrl,zuulHost,uamServer,developDK,tongxunDK} from '@/views/api/api'

import Vue from 'vue';
import axios from 'axios';
let score =[];

/************************************************业务考核的******************************************************************/
export const apiGetList=(ev,params)=>{/*评分的获取列表*/
//	console.log(developUrl);
	let this_url = developUrl+developDK+'statistics/score/search?access_token='+TOKEN;
	return axios({
		method:'post',
		headers : {
	    	'Content-Type' : 'application/json'
		},
		url : this_url,
		data:{
			"groupByType":params.groupByType,
			"orgSerialNo":params.orgSerialNo,
			"roleTypeOfCase":params.roleTypeOfCase,
			"quarterId" :params.quarterId,
			"yearId":params.yearId,
			"monthId" :params.monthId,
			"pageNum":1,	
			"pageSize":10
		},
	}).then((res)=>{
		console.log(res);
		ev.tableData = res.data.list;
		ev.total = res.data.total;
	}).catch((error)=>{
		console.log(error);
	})
}

export const getree=(params={})=>{
	return axios ({
		method:'post',
		url :zuulHost+uamServer+'/organization/tree?access_token='+TOKEN,/*获取部门结构*/
		data:params
	}).then((res)=>res).catch((error)=>{
		console.log(error);
	})
}

export const apiDownload=(params)=>{/*下载导出*/
	let downUrl = developUrl+developDK+'statistics/score/down?roleTypeOfCase='+params.roleTypeOfCase+'&yearId='+params.yearId+'&access_token='+TOKEN;
	downUrl+='&month='+params.monthId+'&quarterId='+params.quarterId+'&orgSerialNo='+params.orgSerialNo+'&groupByType='+params.groupByType;
	return downUrl;
}



/************************************************业务统计的******************************************************************/

export const apiDownloadTong=(params)=>{/*下载*/
	let downUrl = developUrl+developDK+'statistics/amount/down?groupBy='+params.groupBy+'&userName='+params.userName+'&orgName='+params.orgName;
	downUrl +='&yearAndMonthId='+params.yearAndMonthId+'&access_token='+TOKEN;
	return downUrl;
}

export const apiGetListTong=(ev,params)=>{/*业务统计的获取列表*/
//	console.log(developUrl);
	let this_url = developUrl+developDK+'statistics/amount/search?access_token='+TOKEN;/*评分*/
	return axios({
		method:'post',
		headers : {
	    	'Content-Type' : 'application/json'
		},
		url : this_url,
		data:{
			"groupBy":params.groupBy,
			"yearAndMonthId":params.yearAndMonthId,
			"orgName":params.orgName,
			"pageNum":params.pageNum,	
			"pageSize":params.pageSize,	
			"userName":params.userName
		},
	}).then((res)=>{
		console.log(res);
		ev.params.pageTotal = res.data.total;
		ev.tableData = res.data.data
	}).catch((error)=>{
		console.log(error);
	})
}	



export const apiGetListStatus=(ev,params)=>{/*案件类型的获取列表*/
//	console.log(developUrl);
	let this_url = developUrl+developDK+'/statistics/score/searchForCaseType?access_token='+TOKEN;
	return axios({
		method:'post',
		headers : {
	    	'Content-Type' : 'application/json'
		},
		url : this_url,
		data:{
			"yearAndMonthId":params.yearAndMonthId,
			"pageNum":params.pageNum,	
			"pageSize":params.pageSize,	
			"caseStatus" : params.status
		},
	}).then((res)=>{
		console.log(res);
		ev.params.pageTotal = res.data.total;
		ev.tableData = res.data.list;
	}).catch((error)=>{
		console.log(error);
	})
}


export const apiDownloadStatus=(params)=>{/*案件状态下载*/
	let downUrl = developUrl+developDK+'statistics/score/downForCaseType?caseStatus='+params.status;
	downUrl +='&yearAndMonthId='+params.yearAndMonthId+'&access_token='+TOKEN;
	return downUrl;
}